import axios from './http'
// 专题列表
export function categoryList() {
    return axios.post("/post-api/api/bbs/bbsCategory/open/list")
}
// 帖子当前列表
export function postCurrentList(categoryId,) {
    let form = new FormData()
    form.append("categoryId", categoryId)
    return axios.post("/post-api/api/bbs/bbsPosts/open/list", form)
}
// 帖子所有的列表
export function postList() {
    return axios.post("/post-api/api/bbs/bbsPosts/open/list")
}
//  帖子详情
export function postDetail(postsId) {
    return axios.get(`/post-api/api/bbs/bbsPosts/open/detail/${postsId}`)
}
// 帖子详情下面的评论
export function postComment(postsId) {
    let form = new FormData()
    form.append("postsId", postsId)
    return axios.post("/post-api/api/bbs/bbsComment/open/list", form)
}
// 删除帖子
export function deletePost(ids) {
    let form = new FormData()
    form.append("ids", ids)
    return axios.post("/post-api/api/bbs/bbsPosts/site/remove", form)
}
// 发表言论  在帖子详情发表评论
export function publishSpeech(postsId, commentContent) {
    let form = new FormData()
    form.append("postsId", postsId)
    form.append("commentContent", commentContent)
    return axios.post("/post-api/api/bbs/bbsComment/site/add", form)
}
// 删除言论
export function deleteSpeech(ids) {
    let form = new FormData()
    form.append("ids", ids)
    return axios.post("/post-api/api/bbs/bbsComment/site/remove", form)
}
// 回复言论
export function requestSpeech(postsId, parentId, commentContent) {
    let form = new FormData()
    form.append("postsId", postsId)
    form.append("parentId", parentId)
    form.append("commentContent", commentContent)
    return axios.post("/post-api/api/bbs/bbsComment/site/reply/add", form)
}

// 点赞copy
export function like(articleId) {
    return axios.get(`/post-api/api/cms/article/add/zan/${articleId}`)
}


// 修改头像
// export function modifyHead(avatarfile) {
//     let form = new FormData()
//     form.append("avatarfile", avatarfile)
//     return axios.post("/post-api/api/system/user/profile/update/avatar/nos", form)
// }

// 修改图片
export function modifyPic(file, type = "BBS") {
    let form = new FormData()
    form.append("file", file)
    form.append("fileUseForEnum", type)
    return axios.post("/post-api/api/nos/upload/image", form)
}
// 创建帖子
export function createPost(categoryId, title, intro, coverImgUrl) {
    let form = new FormData()
    form.append("categoryId", categoryId)
    form.append("title", title)
    form.append("intro", intro)
    form.append("coverImgUrl", coverImgUrl)
    return axios.post("/post-api/api/bbs/bbsPosts/site/add", form)
}

// 登录
export function login(username, password) {
    let form = new FormData()
    form.append("username", username)
    form.append("rememberMe", true)
    form.append("password", password)
    return axios.post(`/userapi/api/login`, form)
}
// 注册
export function registy(loginName, code, phonenumber, password, userName) {
    let form = new FormData()
    form.append("loginName", loginName)
    form.append("code", code)
    form.append("phonenumber", phonenumber)
    form.append("password", password)
    form.append("userName", userName)
    return axios.post(`/userapi/api/registry`, form)
}
// 忘记密码
export function forget(loginName, password, phonenumber, code) {
    let form = new FormData()
    form.append("loginName", loginName)
    form.append("password", password)
    form.append("phonenumber", phonenumber)
    form.append("code", code)
    return axios.post(`/userapi/api/password/forget`, form)
}
// 短息验证码
export function messageCode(mobile) {
    return axios.get(`userapi/api/short-message/vcode/${mobile}`)
}
// 退出登录
export function logout() {
    return axios.get(`/userapi/api/logout`)
}
// 修改个人信息
export function mineMessage(userName, phonenumber,) {
    let form = new FormData()
    form.append("userName", userName)
    form.append("phoneNumber", phonenumber)
    return axios.post(`/userapi/api/system/user/profile/update`, form)
}
// 修改头像
export function changeAvatar(avatarfile) {
    let form = new FormData()
    form.append("avatarfile", avatarfile)
    return axios.post(`/userapi/api/system/user/profile/update/avatar/nos`, form)
}
// 查看个人信息
export function userInfo() {
    return axios.get(`/userapi/api/login-user/info`)
}
// 查看我发表的帖子
export function checkPost() {
    let form = new FormData()
    return axios.post("/post-api/api/bbs/bbsPosts/join/list", form)
}
// 视频

export function view() {
    return axios.get(`/viewapi/fapig/douyin/billboard?type=hot_video&key=d76167f8409cbc2431f2100f0b8fd813`)
}
// 星座配对
export function constell(men, women) {
    return axios.get(`/viewapi/xzpd/query?men=${men}&women=${women}&key=a00910061cad86c6d701b196183bf6f0`)
}
// 笑话大全
export function joke(page) {
    return axios.get(`/jokeapi/joke/content/text.php?page=${page}&pagesize=20&key=c9bd49bca8c627276d57af68b7867a09`)
}
// 视频
export function video() {
    return axios.get(`/videoapi/txapi/dyvideohot/index?key=a01770367d65aa27071c94f83673409b&type=video
    `)
}
// 猜灯谜
export function guess() {
    return axios.get(`/videoapi/txapi/caizimi/index?key=a01770367d65aa27071c94f83673409b`)
}

